﻿using MediatR;
using S.EarTag.Domain.Model;
using S.EarTag.Infrastructure.Repository.Interface.IEarTagRepository;
using S.EarTag.Read.API.Application.MediatorCommand.BodyMeasureCommand;

namespace S.EarTag.Read.API.Application.MediatorCommandHandler.BodyMeasureCommandHandler
{
    public class BodyMeasureByIdCommandHandler : IRequestHandler<BodyMeasureByIdCommand, BodyMeasureModel>
    {
        private readonly IBodyMeasureModelRepository _bodyMeasureModelRepository;
        public BodyMeasureByIdCommandHandler(IBodyMeasureModelRepository bodyMeasureModelRepository)
        {
            _bodyMeasureModelRepository= bodyMeasureModelRepository;
        }
        /// <summary>
        /// 根据体尺测量主键Id进行查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<BodyMeasureModel> Handle(BodyMeasureByIdCommand request, CancellationToken cancellationToken)
        {
            return await _bodyMeasureModelRepository.GetByIdAsync(request.BodyMeasureId);
        }
    }
}
